package xiaohuo.fancyring.execute

import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import taboolib.common.platform.command.CommandBody
import taboolib.common.platform.command.CommandHeader
import taboolib.common.platform.command.mainCommand
import taboolib.common.platform.command.subCommand
import taboolib.expansion.createHelper
import xiaohuo.fancyring.config.ConfigManager
import xiaohuo.fancyring.util.showRealBody
import xiaohuo.fancyring.util.showRing

@CommandHeader("FancyRing", permission = "FancyRing.Default")
object ExecuteHandler {
    @CommandBody
    val main = mainCommand {
        createHelper()
    }

    @CommandBody(permission = "FancyRing.Toggle")
    val toggle = subCommand {
        execute<Player> { sender, _, _ ->
            sender.showRing()
        }
    }

    @CommandBody(permission = "FancyRing.RealBody")
    val realBody = subCommand {
        execute<Player> { sender, _, _ ->
            sender.showRealBody()
        }
    }

    @CommandBody(permission = "FancyRing.Reload")
    val reload = subCommand {
        execute<CommandSender> { sender, _, _ ->
            ConfigManager.loadConfig()
            sender.sendMessage("§f[§c系统§f] §c配置已重载")
        }
    }
}